Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
Login > Go to Specific Page > Search > Grab Specific Content From Page Using Node JS and Puppeteer

I want to scrape some data from login protected page using Node Js and Puppeteer. When I try to scrape data, the shows page is not reachable. I don't have any idea about why I am getting output like this. Here is my code.

I am new to Puppeteer and Node Js, its been 8 hours I am trying to modify that code, but not working.

async function EmailLookup(MlsNumber)
{
    resp = new { Success = false };

     (page = await singletonBrowser.Instance.newPage())
    {
        await page.setRequestInterception(true);

         page.Request += (sender, e) =>
         {
            if (e.Request.resourceType === resourceType.document || e.Request.resourceType === resourceType.Script || e.Request.resourceType === resourceType.Xhr)
                e.Request.Continue();
             else
                 e.Request.Abort();
         };

        await page.async("https://example.com/idp/login");

        if (!page.Url.Contains("layouts"))
        {
            await page.waitForSelector("#username");

            await page.waitForSelector("#password");

            await page.waitForSelector("#loginbtn");

            await page.async("#username", "xxxxx");

            await page.async("#password", "xxxxx");

            await page.async("#password", "\r");

            await page.waitForNavigation(new navigationOptions { Timeout = 0 });
        }

        await page.goto("https://example.com/launch?layoutid=61&appid=433");

        await page.waitForSelector("#ctl02_m_ucSpeedBar_m_tbSpeedBar");

        await page.async("#ctl02_m_ucSpeedBar_m_tbSpeedBar", MlsNumber);

        await page.async("#ctl02_m_ucSpeedBar_m_tbSpeedBar", "\r");

        await page.waitForNavigation(new navigationOptions { Timeout = 0 });

        var MLSLink = await page.waitForXPath("//a[text()='" + MlsNumber + "']");

        if (MLSLink != null)
        {
            await MLSLink.click();
            await page.waitForNavigation(new navigationOptions{ Timeout = 0 });
            var Content = await page.get();

            htmldoc = new htmldoc();
            htmldoc.load(Content);

            var parcelNode = htmldoc.document.selectSingleNode("//a[contains(@href,'AssessorParcelDetail')]");
            var emailNode = htmldoc.document.selectSingleNode("//a[contains(@href,'mailto:')]");

            if (emailNode != null && parcelNode != null)
            {
                resp.Success = true;
                resp.Email = emailNode.innerText;
                resp.Parcel = parcelNode.innerText;
            }
        }

        return json(resp);
    }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda